{% extends "base.html" %}
{% comment %}
  Copyright 2007 Michael Beccaria

  This file is part of Helios.

  Helios is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  Helios is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with Helios.  If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n %}
{% load discovery_extras %}
{% block title %} | {{ doc.title }}{% endblock %}
{% block head %}
  <link rel="unapi-server" type="application/xml" title="unAPI" href="{% url discovery-unapi %}"/>
{% endblock %}
{% block content %}
  <div id="sidebar">
    <div id="suggested">
      <h3>{% trans "Relevant subjects:" %}</h3>
      <ul>
        {% for term, count in subject_terms %}
          <li><a href="{% new_limit 'subject' term %}">{{ term }}</a> ({{ count }})</li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div id="results">
    <div class="record">
      <abbr class="unapi-id" title="{{ doc.id }}"></abbr>
      <div class="cover">
        <a href="{{ doc.record_url }}">
          {% if doc.upc %}
            <img src="http://worldcat.org/wcpa/servlet/DCARead?standardNo={{ doc.upc|slice:":-1" }}&standardNoType=6" />
          {% else %}{% if doc.isbn_numeric %}
            <img src="http://images.amazon.com/images/P/{{ doc.isbn_numeric }}.01._THUMBZZZ_PB_PU_PU-5_.jpg" />
          {% endif %}{% endif %}
        </a>
      </div>
      <div class="recordinfo">
        {# title_link is in globaltags/globals.py #}
        <h2 class="title">{{ doc.full_title }}</h2>
        {% if doc.summary %}
          <div class="summary">
            <span class="metadata">{% trans "Summary:" %}</span>
            {% for summary in doc.summary %}
              {{ summary }}
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.author %}
          <div class="author">
            <span class="metadata">{% trans "Author:" %}</span>
            {% for author in doc.author %}
              <a href="{% new_limit "author" author %}">{{ author }}</a>
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.name %}
          <div class="names">
            <span class="metadata">{% trans "Names:" %}</span>
            {% for name in doc.name %}
              <a href="{% new_limit "name" name %}">{{ name }}</a>
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.topic %}
          <div class="topics">
            <span class="metadata">{% trans "Topics:" %}</span>
            {% for topic in doc.topic %}
              <a href="{% new_limit "topic" topic %}">{{ topic }}</a>
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.genre %}
          <div class="genres">
            <span class="metadata">{% trans "Genres:" %}</span>
            {% for genre in doc.genre %}
              <a href="{% new_limit "genre" genre %}">{{ genre }}</a>
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.place %}
          <div class="places">
            <span class="metadata">{% trans "Places:" %}</span>
            {% for place in doc.place %}
              <a href="{% new_limit "place" place %}">{{ place }}</a>
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.imprint %}
          <div class="imprint">
            <span class="metadata">{% trans "Imprint:" %}</span>
            {{ doc.imprint }}
          </div>
        {% endif %}
        {% if doc.description %}
          <div class="description">
            <span class="metadata">{% trans "Description:" %}</span>
            {% for note in doc.description %}
              {{ note }}
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.notes %}
          <div class="notes">
            <span class="metadata">{% trans "Notes:" %}</span>
            {% for note in doc.notes %}
              {{ note }}
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.oclc_num %}
          <div class="oclc-num">
            <span class="metadata">{% trans "OCLC Number:" %}</span>
            {{ doc.oclc_num }}
          </div>
        {% endif %}
        {% if doc.isbn %}
          <div class="isbn">
            <span class="metadata">{% trans "ISBNs:" %}</span>
            {% for isbn in doc.isbn %}
              {{ isbn }}
            {% endfor %}
          </div>
        {% endif %}
        {% if doc.upc %}
          <div class="upc">
            <span class="metadata">{% trans "UPC:" %}</span>
            {{ doc.upc }}
          </div>
        {% endif %}
        {% if doc.audience %}
          <div class="audience">
            <span class="metadata">{% trans "Audience:" %}</span>
            <a href="{% new_limit "audience" doc.audience %}">{{ doc.audience }}</a>
          </div>
        {% endif %}
        {% if doc.LCClass or doc.DeweyClass %}
          <div class="callnum">
            {%if doc.LCClass %}
              {%for LCNum in doc.LCClass %}
                {% trans "Call number: " %}{{ LCNum }}{% if not forloop.last %}, {% endif %}
              {% endfor %}
            {% endif %}
            {%if doc.DeweyClass %}
              {%for DeweyNum in doc.DeweyClass %}
                {% trans "Call number: "%}{{DeweyNum}}{% if not forloop.last %}, {% endif %}
              {% endfor %}
            {% endif %}
            {{ callnum }}
          </div>
        {% endif %}
        {% if doc.url %}
          {%for url in doc.url %}
            <div class="url">
              <a href="{{ url }}">{% trans "Online resource" %}</a>
            </div>
          {% endfor %}
        {% endif %}
        {% if doc.SSurldetails %}
          <div class="Journallinks">
            <ul>
              {% for SSurls in doc.SSurldetails %}
                <li>
                  <span class="findit">{%trans "Find it here" %}</span> -&gt;
                  {% for tmp in SSurls %}
                    <a href="{{ tmp }}">{{ tmp }}</a>
                  {% endfor %}
                </li>
              {% endfor %}
            </ul>
          </div>
        {% endif %}
        {% if doc.format %}
          <div class="format {{ doc.format }}">
            <span class="metadata">{% trans "Format:" %}</span>
            <span>{{ doc.format }}</span>
          </div>
        {% endif %}
        <div class="holdings">
          <span class="metadata">{% trans "Holdings:" %}</span>
          {% ifequal ILS "III" %}
            <span class="majax-showholdings" title=".{{ doc.id }}"></span>
          {% endifequal %}
          {% ifequal doc.availability "Available" %}
            <span class="available">{{ doc.availability }}</span>
          {% endifequal %}                               
          {% ifequal doc.availability "Unavailable" %}
            <span class="unavailable">{{ doc.availability }}</span>
          {% endifequal %}
          {% if jangle %}
            <div class="jangle_holdings"><span class="jangle_copies_available">Copies available:  {{ jangle.copies|length }}</span>
              {% for copy in jangle.copies %}
                <div class="jangle_holding">
                  <span class="jangle_holding_number">{{ forloop.counter }})</span>
                  <span class="jangle_holding_status">{{ copy.status|capfirst}}</span>
                  <span class="jangle_holding_message">{{ copy.message}}</span>
                  {% if copy.dateavailable %}
                    <span class="jangle_holding_dueback">Available:  {{ copy.dateavailable}}</span>                  
                  {% endif %}
                </div>
              {% endfor %}
            </div>
          {% endif %}
        </div>
      </div>
    </div>
  </div>    
  {% if DEBUG %}
    <div id="solr-url"><a href="{{ solr_url }}">Solr URL</a></div>
  {% endif %}
{% endblock %}
